// app.config.ts
import { ExpoConfig } from 'expo/config';

// 1. 加载环境变量
require('dotenv').config({ path: `.env.${process.env.EXPO_ENV || 'development'}` });

// 2. 完整保留原配置并增强
const config: ExpoConfig = {
  name: "expo-react-native-ts",
  slug: "expo-react-native-ts",
  version: "1.0.0",
  orientation: "portrait",
  icon: "./assets/images/icon.png",
  scheme: "exporeactnativets",
  userInterfaceStyle: "automatic",
  newArchEnabled: true,
  splash: {
    image: "./assets/images/splash-icon.png",
    resizeMode: "contain",
    backgroundColor: "#ffffff"
  },
  ios: {
    supportsTablet: true
  },
  android: {
    adaptiveIcon: {
      foregroundImage: "./assets/images/adaptive-icon.png",
      backgroundColor: "#ffffff"
    },
    edgeToEdgeEnabled: true
  },
  web: {
    bundler: "metro",
    output: "static",
    favicon: "./assets/images/favicon.png"
  },
  plugins: [
    "expo-router"
  ],
  experiments: {
    typedRoutes: true
  },

  // 3. 新增环境变量（类型安全）
  extra: {
    apiUrl: process.env.API_URL || "https://default.api",
    env: process.env.EXPO_ENV || "development"
  }
};

export default config;